using System;
using System.Collections;
using System.Collections.Generic;
using MyFrame.Event;
using MyFrame.Mono;
using MyFrame.Single;
using UnityEngine;


namespace MyFrame.MyInput
{

    public class InputMgr : Singleton<InputMgr>
    {
        public bool isStart = true;

        public InputMgr()
        {
            MonoMgr.Instance.AddUpdateEvent(MyUpdate);
        }

        public void StartOrEndCheck(bool isStart)
        {
            this.isStart = isStart;
        }

        private void CheckKeyCode(KeyCode key)
        {
            // if (Input.GetKeyDown(key))
            //     EventCenter.Instance.Emit<string>(key.ToString() + "Down", null);
            // if (Input.GetKeyUp(key))
            //     EventCenter.Instance.Emit<string>(key.ToString() + "Up", null);

        }

        /// <summary>
        /// 不断广播
        /// </summary>
        private void MyUpdate()
        {
            if (!isStart) return;
            CheckKeyCode(KeyCode.W);
            CheckKeyCode(KeyCode.A);
            CheckKeyCode(KeyCode.S);
            CheckKeyCode(KeyCode.D);
        }
    }
}
